<template>
<Modal
	v-model="show"
	title="汇率历史记录"
	:width="1000"
	>
	<div>
		<Table :columns="Columns" :data="list" style="width: 100%;" size="small" :border="true">
			<div slot="footer" style="border-top: 1px solid #eee;padding: 0 10px; text-align: right;    font-size: 14px;">
				<div style="float:right;">
					<Page :total="count" show-elevator show-total @on-change="goto_page" />
				</div>
			</div>
		</Table>
	</div>
</Modal>
</template>

<script>


export default {
  name: 'multicurrency_bar',
  data(){
	return {
		show:false,
		Columns: [
			{
				title: '币种名称',
				key: 'name',
				align: 'center',
                width: 160,
            },
			{
                title: '当前汇率',
				key: 'exchange_rate',
				width: 160,
				align: 'center'
            },
			{
                title: '更新日期',
				key: 'addtime',
				width: 260,
				align: 'center'
            },
			{
                title: '更新来源',
				key: 'source',
				width: 160,
				align: 'center'
            },
			{
				title:'操作',
				key: 'ellipsis',
				align: 'center',
			}
        ],
        list: [],
		count:0,
		page:1,
	};
  },
  props:['value','name'],
  created(){
	this.show = this.value;
  },
	watch:{
		value(val){
			if(val){
				this.load_data();
			}
			this.show = val;
		},
		show(val){
			this.$emit('input',val);
		}
	},
  methods: {
	load_data(){
		
		var self = this;
			var postdata = {
				name:this.name,
				page:this.page
			};
			Whttp.load('User/Currency/get_crrency_history',postdata,function(result){console.log(result);
				self.list = result.list;
				self.count = parseInt(result.count)
			})
	},
	goto_page(page){
		this.goto_page = goto_page;
		this.load_data();
	}
  }
}
</script>
<style scoped>

</style>